//
//  LBCCategoryTopCell.m
//  喜马拉雅改良版框架
//
//  Created by dllo on 15/12/30.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "LBCCategoryTopCell.h"

@interface LBCCategoryTopCell ()

@property (nonatomic, strong)UIImageView *headImageView;
@property (nonatomic, strong)UILabel *titleLabel;
@property (nonatomic, strong)UILabel *contentLabel;

@end

@implementation LBCCategoryTopCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.headImageView = [UIImageView new];
        [self.contentView addSubview:_headImageView];
        [_headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.mas_equalTo(10);
            make.bottom.mas_equalTo(-10);
            make.width.equalTo(_headImageView.mas_height);
            
        }];
        
        self.titleLabel = [UILabel new];
        _titleLabel.font = [UIFont systemFontOfSize:20];
        [self.contentView addSubview:_titleLabel];
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_headImageView).offset(5);
            make.left.equalTo(_headImageView.mas_right).offset(10);
            make.right.mas_equalTo(-SCREEN_WIDTH / 22);
            
        }];
        
        self.contentLabel = [UILabel new];
        _contentLabel.textColor = [UIColor colorWithRed:0.69 green:0.69 blue:0.69 alpha:1];
        [self.contentView addSubview:_contentLabel];
        [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_titleLabel.mas_bottom).offset(10);
            make.left.right.equalTo(_titleLabel);
            make.bottom.equalTo(_headImageView).offset(-5);
            
        }];
        
    }
    return self;
}


-(void)setTopDic:(NSMutableDictionary *)topDic{
    _topDic = topDic;
    [_headImageView sd_setImageWithURL:[NSURL URLWithString:[_topDic objectForKey:@"coverPath"]] placeholderImage:[UIImage imageNamed:ImagePlaceHolder]];
    _titleLabel.text = [_topDic objectForKey:@"title"];
    _contentLabel.text = [_topDic objectForKey:@"subtitle"];
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
